package com.itheima.day05;

import java.time.LocalDate;
import java.time.Period;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class zuoyetest {
    public static void main(String[] args) {
        LocalDate now = LocalDate.now();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的生日：");
        String birth = sc.next();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate birth1 = LocalDate.parse(birth, formatter);
        Period period = Period.between(birth1, now);
        System.out.println("您已经活了"+period.getYears()+"年"+period.getMonths()+"月"+period.getDays()+"天");
    }
}
